﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admins/Administrator.Master" AutoEventWireup="true"
    CodeFile="Order.aspx.cs" Inherits="FacebookApp.Admins_Order" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="title">
        Order Manager</div>
    <asp:Panel ID="pnShow" runat="server" Width="100%">
        <table id="Table1" style="border-collapse: collapse; background-color: #EBEEF4;"
            cellpadding="0" width="100%" border="0">
            <tr>
                <td>
                    <%--<asp:Button ID="btnThem" runat="server" CssClass="btnthem" Text="Thêm mới" OnClick="btnThem_Click" />--%>
                    <asp:Button ID="btnXoa" runat="server" class="fb_invite_button" Text="Delete" OnClick="btnXoa_Click" />
                </td>
            </tr>
        </table>
        <asp:DataGrid ID="grdOrder" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="4" ForeColor="#333333" Width="100%" OnPageIndexChanged="grdOrder_PageIndexChanged"
            PageSize="10" OnItemCommand="grdOrder_ItemCommand" OnItemDataBound="grdOrder_ItemDataBound">
            <AlternatingItemStyle BackColor="White" />
            <HeaderStyle CssClass="trHeader"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn ItemStyle-CssClass="tdCenter">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="False"></asp:CheckBox></HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelect" runat="server"></asp:CheckBox></ItemTemplate>
                    <ItemStyle CssClass="tdCenter" HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="Id" HeaderText="Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="FB_Id" HeaderText="FB_Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="FullName" HeaderText="FullName"></asp:BoundColumn>                
                <asp:BoundColumn DataField="Address" HeaderText="Address"></asp:BoundColumn>                
                <asp:BoundColumn DataField="Phone" HeaderText="Phone"></asp:BoundColumn>                
                <asp:BoundColumn DataField="Date" HeaderText="Date"></asp:BoundColumn>
                <asp:BoundColumn DataField="TotalMoney" HeaderText="TotalMoney"></asp:BoundColumn>
                <asp:BoundColumn DataField="Status" HeaderText="Status"></asp:BoundColumn>
                <asp:TemplateColumn ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        Function</HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="lbt1" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")%>'
                            CommandName="Edit" CssClass="edit" ToolTip="View Order">&nbsp;</asp:LinkButton>|
                            <asp:LinkButton
                                ID="lbt2" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")%>'
                                CommandName="Delete" CssClass="delete" OnClientClick="return confirm('Do you want to delete?')"
                                ToolTip="Delete">&nbsp;</asp:LinkButton>
                                </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                </asp:TemplateColumn>
            </Columns>
            <EditItemStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
            <ItemStyle BackColor="#EFF3FB" />
            <PagerStyle BackColor="#F3F8FE" ForeColor="Blue" HorizontalAlign="Center" Mode="NumericPages" />
            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        </asp:DataGrid></asp:Panel>
    <asp:Panel ID="pnUpdate" runat="server" Visible="False" Width="100%">       
        <table id="Table2" style="border-collapse: collapse; border: none;" cellpadding="2"
            width="100%" cssClass="TableView">
            <tr>
                <td style="width: 100%;">
                    <asp:TextBox ID="txtID" runat="server" Visible="false" />
                </td>
            </tr>
            <tr>
                <td style="color: Red;">
                    <h2>
                        Thông tin khách hàng</h2>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:DataGrid ID="grdCustomer" runat="server" Width="100%" AutoGenerateColumns="False"
                        ShowHeader="False">
                        <Columns>
                            <asp:TemplateColumn>
                                <ItemTemplate>
                                    <table border="0">
                                        <tr>
                                            <td>
                                                Họ tên:
                                            </td>
                                            <td>
                                                <%# Eval("FullName").ToString()%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Địa chỉ:
                                            </td>
                                            <td>
                                                <%# Eval("Address").ToString()%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Điện thoại:
                                            </td>
                                            <td>
                                                <%# Eval("Phone").ToString()%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Email:
                                            </td>
                                            <td>
                                                <%# Eval("Email").ToString()%>
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                        </Columns>
                    </asp:DataGrid>
                </td>
            </tr>
            <tr>
                <td>
                    <h2>
                        Thông tin đơn hàng</h2>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:DataGrid ID="grdshopcard" runat="server" AutoGenerateColumns="False" CellPadding="10"
                        Width="100%">
                        <Columns>
                            <asp:TemplateColumn HeaderStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    Sản phẩm</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblProductID" Text='<%#Eval("Ebook_Id")%>' Visible="false" runat="server" />
                                    <%#Tensanpham(Eval("Ebook_Id").ToString())%><br />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:TemplateColumn>
                            <asp:TemplateColumn ItemStyle-Width="100px" HeaderStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    Số lượng</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblQuantity" Text='<%# Eval("Quantity").ToString()%>' runat="server" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn ItemStyle-Width="100px" HeaderStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    Giá bán</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Format_Price(Eval("Money").ToString())%>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn ItemStyle-Width="150px" HeaderStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    Thành tiền(VNĐ)</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lbltotal" runat="server" Text='<%#Format_Price((Double.Parse(Eval("Money").ToString()) * Int32.Parse(Eval("Quantity").ToString())).ToString())%>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Right" Width="150px"></ItemStyle>
                            </asp:TemplateColumn>
                        </Columns>
                        <HeaderStyle BackColor="#E8E8E8" BorderColor="#B3B3B3" BorderStyle="Solid" BorderWidth="1px"
                            Font-Bold="True" Height="30px" />
                        <ItemStyle BorderColor="#B3B3B3" BorderStyle="Solid" BorderWidth="1px" />
                    </asp:DataGrid>
                    <table width="100%" border="0" cellspacing="0" cellpadding="3" style="background: #E8E8E8;
                        border-collapse: collapse">
                        <tr style="border: 1px solid #FFF; height: 30px">
                            <td width="57%" align="right" style="border-left: 1px solid #B3B3B3; border-bottom: 1px solid #B3B3B3">
                                <asp:Label ID="lblsum" runat="server" Text="Tổng số tiền" Font-Bold="True"></asp:Label>
                            </td>
                            <td width="3%" style="border-bottom: 1px solid #B3B3B3">
                                &nbsp;
                            </td>
                            <td width="20%" style="border-right: 1px solid #B3B3B3; border-bottom: 1px solid #B3B3B3;
                                padding-right: 20px" align="right">
                                <asp:Label ID="lblsumpay" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <br />
                </td>
                <td>
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;<asp:LinkButton ID="lbtUpdate" CssClass="update" runat="server" OnClick="lblUpdate_Click">Checkout</asp:LinkButton>&nbsp;&nbsp;
                    <asp:LinkButton ID="lblBack" runat="server" CssClass="back" OnClick="lblBack_Click">Back</asp:LinkButton>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
